<%@ Language=VBScript%>
<%
	Session("FormName")="F0"	
%>
<!--#include file=checkSession.inc-->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<%
if Session("IsAdmin") then
	bComm=Request("bComm")
	if bComm="insert" then		
		if InsertQuyen("Chuyển tiếp xử lý công việc","F37-1") then
			response.write ("Inserted Chuyển tiếp xử lý công việc")
			response.write ("<br>")
		else
			response.write ("NOT Inserted Chuyển tiếp xử lý công việc")
			response.write ("<br>")
		end if
	end if
end if
%>

<script language=VBScript runat=server>
	Function InsertQuyen(bTenQuyen,bQuyenCode)
		InsertQuyen=True
		sSQL="select quyen_code from dsquyen where quyen_code='"& trim(bQuyenCode) &"'"
		Set RecTemp=server.CreateObject("ADODB.Recordset")
		RecTemp.Open sSQL,Conn
		if (not RecTemp.BOF) and (not RecTemp.EOF) then
			InsertQuyen=false
		else
				Conn.BeginTrans					
				sSQL="Insert into dsquyen(ten_quyen,quyen_code)values('"& bTenQuyen &"','"& bQuyenCode &"')"
				Conn.Execute sSQL
				if Err.number then
					Conn.RollbackTrans
				else
					Conn.CommitTrans
				end if
				Err.Clear
		end if
		set RecTemp=nothing
	End function

	Function UpdateQuyen(bTenQuyen,bQuyenCode)
		UpdateQuyen=True
		sSQL="select quyen_code from dsquyen where quyen_code='"& trim(bQuyenCode) &"'"
		Set RecTemp=server.CreateObject("ADODB.Recordset")
		RecTemp.Open sSQL,Conn
		if (not RecTemp.BOF) and (not RecTemp.EOF) then
			Conn.BeginTrans					
			sSQL="UPDATE dsquyen set ten_quyen= '"& bTenQuyen &"' where quyen_code='"& bQuyenCode &"'"
			Conn.Execute sSQL
			if Err.number then
				Conn.RollbackTrans
			else
				Conn.CommitTrans
			end if
			Err.Clear		
		else
			UpdateQuyen=false		
		end if
		set RecTemp=nothing
	End function	
		
</script>

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function CmdAdd_onclick() {	
	//window.nhom.target="_blank"
	window.nhom.action="InsertQuyen37.asp?bComm=insert";
	window.nhom.submit();
}
//-->
</SCRIPT>
<form name="nhom" method="POST">
<body  topmargin="0" leftmargin="0" bgcolor=#F8F9D9 style="font-family:times new roman">
<br>
<center>
<Button name="CmdAdd" align="center" style="FONT-FAMILY: Arial;WIDTH: 10%" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><U>T</U>hêm</Button></td>
</center>
</body>
</form>
</html>
<%
	Conn.Close
	Set Conn=nothing
%>